package my.food.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import my.food.entity.Comment;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: ling
 * Date: 2024-05-16
 * Time: 20:41
 */
@Mapper
public interface CommentMapper extends BaseMapper<Comment> {

    @Select("SELECT * FROM COMMENT")
    public List<Comment> selectAll();


    @Insert("INSERT INTO COMMENT (user_id, comment_content, stars) VALUES (#{user_id}, #{comment_content}, #{stars})")
    int insertAll(@Param("user_id") Integer user_id, @Param("comment_content") String comment_content,
                  @Param("stars") Integer stars);
}
